package pay;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * User: Jahnke [1029777564@qq.com]
 * Date: 2017-01-08 8:46
 * 支付渠道
 */
public class ChannelUtils {
    //支付方式
    private static List<String> channelType = new ArrayList<String>();
    private static Map<String, String> channelMap = new HashMap<>();


    public final static String alipay = "alipay";
    public final static String alipay_qr = "alipay_qr";
    public final static String alipay_wap = "alipay_wap";
    public final static String wx = "wx";
    public final static String wx_pub_qr = "wx_pub_qr";
    public final static String wx_pub_wap = "wx_pub_wap";
    public final static String wx_gzh = "wx_gzh";
    public final static String wx_xcx = "wx_xcx";
    public final static String paypal = "paypal";
    public final static String stripe = "stripe";
    public final static String apacpay = "apacpay";
    public final static String yiyi = "yiyi"; // 南京一乙，第三方支付
    public final static String wo_pay = "wo_pay"; // 沃支付
    public final static String transit = "transit"; // 北美信用卡支付（天天生鲜的）
    public final static String paypay = "paypay";
    public final static String linepay = "linepay";

    static {
        channelType.add("alipay");              //支付宝手机支付
        channelType.add("alipay_qr");              //支付宝扫码支付
        channelType.add("wx");              //微信支付
        channelType.add("wx_pub_qr");              //微信公众账号扫码支付

        channelType.add("alipay_wap");              //支付宝手机网页支付
        channelType.add("alipay_pc_direct");              //支付宝 PC 网页支付
        channelType.add("bfb");              //百度钱包移动快捷支付
        channelType.add("bfb_wap");              //百度钱包手机网页支付
        channelType.add("upacp");              //银联全渠道支付（2015 年 1 月 1 日后的银联新商户使用。若有疑问，请与 Ping++ 或者相关的收单行联系）
        channelType.add("upacp_wap");              //银联全渠道手机网页支付（2015 年 1 月 1 日后的银联新商户使用。若有疑问，请与 Ping++ 或者相关的收单行联系）
        channelType.add("upacp_pc");              //银联 PC 网页支付
        channelType.add("cp_b2b");              //银联企业网银支付
        channelType.add("wx_pub");              //微信公众账号支付
        channelType.add("yeepay_wap");              //易宝手机网页支付
        channelType.add("jdpay_wap");              //京东手机网页支付
        channelType.add("cnp_u");              //应用内快捷支付（银联）
        channelType.add("cnp_f");              //应用内快捷支付（外卡）
        channelType.add("applepay_upacp");              //Apple Pay

        channelMap.put("alipay", "支付宝");
        channelMap.put("alipay_qr", "支付宝");
        channelMap.put("alipay_wap", "支付宝手机网页支付");              //微信公众账号扫码支付
        channelMap.put("wx", "微信");
        channelMap.put("wx_pub_qr", "微信公众账号扫码支付");              //微信公众账号扫码支付
        channelMap.put("wx_pub_wap", "微信支付");
        channelMap.put("wx_gzh", "微信公众号支付");
        channelMap.put("wx_xcx", "微信小程序");
        channelMap.put("paypal", "paypal 支付");
        channelMap.put("apacpay", "apacpay 支付");
        channelMap.put("wo_pay", "沃支付");
        channelMap.put("transit", "信用卡支付");
        channelMap.put("paypay", "paypay 支付");
        channelMap.put("linepay", "linepay 支付");
    }


    public static boolean channelExit(String channel) {
        if (channelType.contains(channel)) {
            return true;
        }
        return false;
    }


    public static String getChannelName(String channel) {
        if (channel == null || channel.equals("")) {
            return "";
        }
        if (channelMap.containsKey(channel)) {
            return channelMap.get(channel);
        }
        return "";
    }
}
